package com.pansoft.openplanet.util;

import okhttp3.Request;
import okhttp3.Response;

/**
 * Ipcom和Telecomm的token刷新实现
 *
 * @author wang
 */
public class IPComTokenRefresh implements TCTokenInterceptor.ITokenRefresh {

    public IPComTokenRefresh() {
    }

    @Override
    public Response getRefreshToken(Request request) {
        //重新请求token，调用反射方法，因为EV变量这里不能直接拿到
        try {
            String tag = request.tag() == null ? "" : request.tag().toString();
            return TCRequestUtil.refreshAccessTokenSync(tag);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}
